<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/swiper/swiper-bundle.min.js"></script>
    <link rel="stylesheet" href="./lib/swiper/swiper-bundle.css">
    <style>
        .kerwin{
            width: 500px;
            height: 500px;
        }
    </style>
</head>
<body>
    <header>header</header>
    <div class="swiper kerwin">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
        
        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
        
        <!-- 如果需要滚动条 -->
        <!-- <div class="swiper-scrollbar"></div> -->
    </div>
</body>
<script>
    setTimeout(()=>{
        let list = ['aaa','bbb','ccc']
        let newlsit = list.map(item=>`<div class="swiper-slide">${item}</div>`)
        let app=document.querySelector('.swiper-wrapper')
        app.innerHTML=newlsit.join('')
        init()
    },2000)
   function init(){
    new Swiper('.kerwin',{
        pagination:{
            el:'.swiper-pagination'
        },
        navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
    loop:true,
    autoplay: {
          delay: 2500,
          disableOnInteraction: false,
        },
    })
   }
</script>
</html>